﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using Wpf.CommonTools.SystemExtension;

namespace Convertor
{
    class PluginIconConverter : IValueConverter
    {
        #region IValueConverter 成员

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            if (value == null)
            {
                return "Images/Array.gif";
            }
            else if (value.ToString().StartsWith(UILanguage.TryFindResource("PluginType_Array")))
            {
                return "Images/Array.gif";
            }
            else if (value.ToString().StartsWith(UILanguage.TryFindResource("PluginType_Web")))
            {
                return "Images/Web.gif";
            }
            else if (value.ToString().StartsWith(UILanguage.TryFindResource("PluginType_Text")))
            {
                return "Images/Text.gif";
            }
            else if (value.ToString().StartsWith(UILanguage.TryFindResource("PluginType_Database")))
            {
                return "Images/Database.png";
            }
            else if (value.ToString().StartsWith(UILanguage.TryFindResource("PluginType_File")))
            {
                return "Images/File.gif";
            }
            else if (value.ToString().StartsWith(UILanguage.TryFindResource("PluginType_System")))
            {
                return "Images/Setting.png";
            }
            else
            {
                return null;
            }
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
